<template>
  <div class="app">
    w是APP组件-钱包：{{ money }} -银行信息 ：{{ info }}
    <button @click="changeMoney">修改数据</button>
    <button @click="changeBankMoney">修改银行卡数据</button>
    <SonA></SonA>
    <SonB></SonB>
  </div>
</template>

<script>
import SonA from './components/SonA.vue'
import SonB from './components/SonB.vue'
export default {
  provide(){
    return {
      money:this.money,
      info:this.info
    }
  },
  data() {
    return {
      money:999999,
      info:{
        name:'张三风',
        bankMoney:186535466666666,
      }
    }
  },
  methods: {
   changeMoney(){
    this.money += 10000
   },
   changeBankMoney(){
    // 如果需要跨代传值的数据是响应式的，需要把爷爷要传递的数据类型变成复杂类型
    this.info.bankMoney -= 10000
   }
  },
  components: {
    SonA,
    SonB,
  },
}
</script>

<style>
.app {
  border: 3px solid #000;
  border-radius: 6px;
  margin: 10px;
}
</style>